# coding=utf-8
# !/usr/bin/python3
import json

import execjs
import requests

headers = {
    'accept': 'application/json, text/plain, */*',
    'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
    'content-type': 'application/x-www-form-urlencoded',
    'origin': 'https://www.jinglingshuju.com',
    'priority': 'u=1, i',
    'sec-ch-ua': '"Chromium";v="128", "Not;A=Brand";v="24", "Microsoft Edge";v="128"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-site',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0',
}

data = {
    'uid': 'undefined',
}

response = requests.post('https://vapi.jinglingshuju.com/Data/getNewsList', headers=headers, data=data)
data=response.json()['data']
with open('./精灵数据.js', 'r', encoding='utf-8') as js_file:
    js_code = js_file.read()
js_compile = execjs.compile(js_code).call('decrypt',data)
print(json.dumps(js_compile, ensure_ascii=False, indent=4))